package API.DAY11.reflect;

import java.lang.reflect.Field;
import java.util.Arrays;

public class ReflectDemo9 {
    public static void main(String[] args) throws Exception{
        String s1 = "hello";
        String s2 = "hello";
        System.out.println("s1:"+s1);
        System.out.println("s2:"+s2);

        Class cls = String.class;
        Field filed = cls.getDeclaredField("value");
        filed.setAccessible(true);
        char[] chars = (char[])filed.get(s1);
        System.out.println(Arrays.toString(chars));

        char[] chars1 = new char[]{'j','a','v','a'};
        filed.set(s1,chars1);

        System.out.println(s1);
        System.out.println(s2);

        String s3 = "hello";
        System.out.println(s3);
    }
}
